/*
 * @Author: your name
 * @Date: 2021-09-03 08:52:18
 * @LastEditTime: 2021-09-03 23:39:11
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \phytium-standalone-sdk\board\common\_cpu.c
 */
#include "_cpu.h"
#include "parameters.h"

u32 GetCpuId(void)
{
    u32 affinity = GetAffinity();
    
    switch (affinity & 0xfff)
    {
    case CORE0_AFF:
        return 0;
    case CORE1_AFF:
        return 1;
    case CORE2_AFF:
        return 2;
    case CORE3_AFF:
        return 3;
    default:
        return 0;
    }
    return 0;
}

unsigned long GetCpuCluster(u32 cpu_id)
{
    switch (cpu_id)
    {
    case (1<<0):
        return CORE0_AFF;
    case (1<<1):
        return CORE1_AFF;
    case (1<<2):
        return CORE2_AFF;
    case (1<<3):
        return CORE3_AFF;
    case (1<<4):
        return 0x200;
    case (1<<5):
        return 0x201;
    case (1<<6):
        return 0x300;
    case (1<<7):
        return 0x301;
    default:
        return 0;
    }
}
